<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Class: OptionSet
  
    &mdash; Documentation by YARD 0.7.3
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  relpath = '';
  if (relpath != '') relpath += '/';
</script>

  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <script type="text/javascript" charset="utf-8">
      if (window.top.frames.main) document.body.className = 'frames';
    </script>
    
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (O)</a> &raquo; 
    
    
    <span class="title">OptionSet</span>
  
  
  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a id="class_list_link" href="#">Class List</a>
  
    <a id="method_list_link" href="#">Method List</a>
  
    <a id="file_list_link" href="#">File List</a>
  
</div>
      <div class="clear"></div>
    </div>
    
    <iframe id="search_frame"></iframe>
    
    <div id="content"><h1>Class: OptionSet
  
  
  
</h1>

<dl class="box">
  
    <dt class="r1">Inherits:</dt>
    <dd class="r1">
      <span class="inheritName">ActiveRecord::Base</span>
      
        <ul class="fullTree">
          <li>Object</li>
          
            <li class="next">ActiveRecord::Base</li>
          
            <li class="next">OptionSet</li>
          
        </ul>
        <a href="#" class="inheritanceTree">show all</a>
      
      </dd>
    
  
  
    
  
    
  
  
  
    <dt class="r2 last">Defined in:</dt>
    <dd class="r2 last">app/models/option_set.rb</dd>
  
</dl>
<div class="clear"></div>

<h2>Overview</h2><div class="docstring">
  <div class="discussion">
    <p>
ELMO - Secure, robust, and versatile data collection. Copyright 2011 The
Carter Center
</p>
<p>
ELMO is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
</p>
<p>
ELMO is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
</p>
<p>
You should have received a copy of the GNU General Public License along
with ELMO. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</p>


  </div>
</div>
<div class="tags">
  

</div>

  


  

  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#default_eager-class_method" title="default_eager (class method)">+ (Object) <strong>default_eager</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#orderings-class_method" title="orderings (class method)">+ (Object) <strong>orderings</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#per_page-class_method" title="per_page (class method)">+ (Object) <strong>per_page</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#select_options-class_method" title="select_options (class method)">+ (Object) <strong>select_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted-class_method" title="sorted (class method)">+ (Object) <strong>sorted</strong>(params = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#all_option_settings-instance_method" title="#all_option_settings (instance method)">- (Object) <strong>all_option_settings</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>
finds or initializes an option_setting for every option in the database
(never meant to be saved).
</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#all_option_settings%3D-instance_method" title="#all_option_settings= (instance method)">- (Object) <strong>all_option_settings=</strong>(params) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#option_setting_for-instance_method" title="#option_setting_for (instance method)">- (Object) <strong>option_setting_for</strong>(option) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#option_setting_hash-instance_method" title="#option_setting_hash (instance method)">- (Object) <strong>option_setting_hash</strong>(options = {}) </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#published%3F-instance_method" title="#published? (instance method)">- (Boolean) <strong>published?</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#sorted_options-instance_method" title="#sorted_options (instance method)">- (Object) <strong>sorted_options</strong> </a>
    

    
  </span>
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
    </ul>
  


  

  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="default_eager-class_method">
  
    + (<tt>Object</tt>) <strong>default_eager</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 37</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='default_eager identifier id'>default_eager</span><span class='semicolon token'>;</span> <span class='lbrack token'>[</span><span class='lbrace token'>{</span><span class='symbol val'>:questionings</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='symbol val'>:form</span><span class='rbrace token'>}</span><span class='comma token'>,</span> <span class='symbol val'>:questions</span><span class='comma token'>,</span> <span class='symbol val'>:options</span><span class='rbrack token'>]</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="orderings-class_method">
  
    + (<tt>Object</tt>) <strong>orderings</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


43
44
45
46</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 43</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='orderings identifier id'>orderings</span>
  <span class='lbrack token'>[</span><span class='lbrace token'>{</span><span class='symbol val'>:code</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;value_asc&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;Value Low to High&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:sql</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;value asc&quot;</span><span class='rbrace token'>}</span><span class='comma token'>,</span>
   <span class='lbrace token'>{</span><span class='symbol val'>:code</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;value_desc&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:name</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;Value High to Low&quot;</span><span class='comma token'>,</span> <span class='symbol val'>:sql</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;value desc&quot;</span><span class='rbrace token'>}</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="per_page-class_method">
  
    + (<tt>Object</tt>) <strong>per_page</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


35</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 35</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='per_page identifier id'>per_page</span><span class='semicolon token'>;</span> <span class='integer val'>100</span> <span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="select_options-class_method">
  
    + (<tt>Object</tt>) <strong>select_options</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


39
40
41</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 39</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='select_options identifier id'>select_options</span>
  <span class='all identifier id'>all</span><span class='lparen token'>(</span><span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;name&quot;</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='os identifier id'>os</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='os identifier id'>os</span><span class='dot token'>.</span><span class='name identifier id'>name</span><span class='comma token'>,</span> <span class='os identifier id'>os</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted-class_method">
  
    + (<tt>Object</tt>) <strong>sorted</strong>(params = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


31
32
33</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 31</span>

<span class='def def kw'>def</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='sorted identifier id'>sorted</span><span class='lparen token'>(</span><span class='params identifier id'>params</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='paginate identifier id'>paginate</span><span class='lparen token'>(</span><span class='symbol val'>:all</span><span class='comma token'>,</span> <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='merge identifier id'>merge</span><span class='lparen token'>(</span><span class='symbol val'>:order</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>&quot;name&quot;</span><span class='rparen token'>)</span><span class='rparen token'>)</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>
    
    
      <div class="method_details first">
  <p class="signature first" id="all_option_settings-instance_method">
  
    - (<tt>Object</tt>) <strong>all_option_settings</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    <p>
finds or initializes an option_setting for every option in the database
(never meant to be saved)
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


58
59
60
61</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 58</span>

<span class='def def kw'>def</span> <span class='all_option_settings identifier id'>all_option_settings</span>
  <span class='comment val'># make sure there is an associated answer object for each questioning in the form</span>
  <span class='Option constant id'>Option</span><span class='dot token'>.</span><span class='all identifier id'>all</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='o identifier id'>o</span><span class='bitor op'>|</span> <span class='option_setting_for identifier id'>option_setting_for</span><span class='lparen token'>(</span><span class='o identifier id'>o</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='option_settings identifier id'>option_settings</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='symbol val'>:option_id</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='o identifier id'>o</span><span class='dot token'>.</span><span class='id identifier id'>id</span><span class='comma token'>,</span> <span class='symbol val'>:included</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='false false kw'>false</span><span class='rparen token'>)</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="all_option_settings=-instance_method">
  
    - (<tt>Object</tt>) <strong>all_option_settings=</strong>(params) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 63</span>

<span class='def def kw'>def</span> <span class='all_option_settings= identifier id'>all_option_settings=</span><span class='lparen token'>(</span><span class='params identifier id'>params</span><span class='rparen token'>)</span>
  <span class='comment val'># create a bunch of temp objects, discarding any unchecked options</span>
  <span class='submitted identifier id'>submitted</span> <span class='assign token'>=</span> <span class='params identifier id'>params</span><span class='dot token'>.</span><span class='values identifier id'>values</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='p identifier id'>p</span><span class='bitor op'>|</span> <span class='p identifier id'>p</span><span class='lbrack token'>[</span><span class='symbol val'>:included</span><span class='rbrack token'>]</span> <span class='eq op'>==</span> <span class='string val'>'1'</span> <span class='question op'>?</span> <span class='OptionSetting constant id'>OptionSetting</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='p identifier id'>p</span><span class='rparen token'>)</span> <span class='colon op'>:</span> <span class='nil nil kw'>nil</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span>
  
  <span class='comment val'># copy new choices into old objects, creating or deleting if necessary</span>
  <span class='option_settings identifier id'>option_settings</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='submitted identifier id'>submitted</span><span class='comma token'>,</span> <span class='Proc constant id'>Proc</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='os identifier id'>os</span><span class='bitor op'>|</span> <span class='os identifier id'>os</span><span class='dot token'>.</span><span class='option_id identifier id'>option_id</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='orig identifier id'>orig</span><span class='comma token'>,</span> <span class='subd identifier id'>subd</span><span class='bitor op'>|</span>
    <span class='comment val'># if both exist, do nothing</span>
    <span class='comment val'># if submitted is nil, destroy the original</span>
    <span class='if if kw'>if</span> <span class='subd identifier id'>subd</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
      <span class='option_settings identifier id'>option_settings</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span><span class='lparen token'>(</span><span class='orig identifier id'>orig</span><span class='rparen token'>)</span>
    <span class='comment val'># if original is nil, add the new one to this option_set's array</span>
    <span class='elsif elsif kw'>elsif</span> <span class='orig identifier id'>orig</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
      <span class='option_settings identifier id'>option_settings</span> <span class='lshft op'>&lt;&lt;</span> <span class='subd identifier id'>subd</span>
    <span class='end end kw'>end</span>
  <span class='end end kw'>end</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="option_setting_for-instance_method">
  
    - (<tt>Object</tt>) <strong>option_setting_for</strong>(option) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


80
81
82
83</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 80</span>

<span class='def def kw'>def</span> <span class='option_setting_for identifier id'>option_setting_for</span><span class='lparen token'>(</span><span class='option identifier id'>option</span><span class='rparen token'>)</span>
  <span class='comment val'># get the matching option_setting</span>
  <span class='option_setting_hash identifier id'>option_setting_hash</span><span class='lbrack token'>[</span><span class='option identifier id'>option</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="option_setting_hash-instance_method">
  
    - (<tt>Object</tt>) <strong>option_setting_hash</strong>(options = {}) 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


85
86
87
88</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 85</span>

<span class='def def kw'>def</span> <span class='option_setting_hash identifier id'>option_setting_hash</span><span class='lparen token'>(</span><span class='options identifier id'>options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
  <span class='@option_setting_hash ivar id'>@option_setting_hash</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span> <span class='if if_mod kw'>if</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:rebuild</span><span class='rbrack token'>]</span>
  <span class='@option_setting_hash ivar id'>@option_setting_hash</span> <span class='opasgn op'>||=</span> <span class='Hash constant id'>Hash</span><span class='lbrack token'>[</span><span class='mult op'>*</span><span class='option_settings identifier id'>option_settings</span><span class='dot token'>.</span><span class='collect identifier id'>collect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='os identifier id'>os</span><span class='bitor op'>|</span> <span class='lbrack token'>[</span><span class='os identifier id'>os</span><span class='dot token'>.</span><span class='option identifier id'>option</span><span class='comma token'>,</span> <span class='os identifier id'>os</span><span class='rbrack token'>]</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='rbrack token'>]</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="published?-instance_method">
  
    - (<tt>Boolean</tt>) <strong>published?</strong> 
  

  
</p><div class="docstring">
  <div class="discussion">
    

  </div>
</div>
<div class="tags">
  
<h3>Returns:</h3>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Boolean</tt>)</span>
      
      
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


52
53
54
55</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 52</span>

<span class='def def kw'>def</span> <span class='published? fid id'>published?</span>
  <span class='comment val'># check for any published questionings</span>
  <span class='notop op'>!</span><span class='questionings identifier id'>questionings</span><span class='dot token'>.</span><span class='detect identifier id'>detect</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='qing identifier id'>qing</span><span class='bitor op'>|</span> <span class='qing identifier id'>qing</span><span class='dot token'>.</span><span class='published? fid id'>published?</span><span class='rbrace token'>}</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <p class="signature " id="sorted_options-instance_method">
  
    - (<tt>Object</tt>) <strong>sorted_options</strong> 
  

  
</p><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


48
49
50</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/models/option_set.rb', line 48</span>

<span class='def def kw'>def</span> <span class='sorted_options identifier id'>sorted_options</span>
  <span class='@sorted_options ivar id'>@sorted_options</span> <span class='opasgn op'>||=</span> <span class='options identifier id'>options</span><span class='dot token'>.</span><span class='sort identifier id'>sort</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='a identifier id'>a</span><span class='comma token'>,</span><span class='b identifier id'>b</span><span class='bitor op'>|</span> <span class='lparen token'>(</span><span class='a identifier id'>a</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span> <span class='cmp op'>&lt;=&gt;</span> <span class='b identifier id'>b</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span><span class='rparen token'>)</span> <span class='mult op'>*</span> <span class='lparen token'>(</span><span class='ordering identifier id'>ordering</span> <span class='andop op'>&amp;&amp;</span> <span class='ordering identifier id'>ordering</span><span class='dot token'>.</span><span class='match identifier id'>match</span><span class='lparen token'>(</span><span class='regexp val'>/desc/</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='integer val'>-1</span> <span class='colon op'>:</span> <span class='integer val'>1</span><span class='rparen token'>)</span><span class='rbrace token'>}</span>
<span class='end end kw'>end</span>
</pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>
    
    <div id="footer">
  Generated on Thu Dec  8 13:43:25 2011 by 
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.7.3 (ruby-1.8.7).
</div>

  </body>
</html>